#BIN=code.exe
#SRC=$(shell ls *.c)
#OBJ=$(SRC:.c=.o)
#$(BIN):$(OBJ)
#	@gcc -o $@ $^
#%.o:%.c
#	@gcc -c $<
#.PHONY:clean
#clean:
#	@rm $(BIN) $(OBJ)
#


BIN=code 
CC=gcc
#SRC=$(shell ls *.c)
SRC=$(wildcard *.c)
OBJ=$(SRC:.c=.o)
LFLAGS=-o
FLAGS=-c
RM=rm -f

$(BIN):$(OBJ)
	@$(CC) $(LFLAGS) $@ $^
	@echo "linking ... $^ to $@"
%.o:%.c
	@$(CC) $(FLAGS) $<
	@echo "compling ... $< to $@"
.PHONY:clean
clean:
	$(RM) $(OBJ) $(BIN)
